#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 2e5 + 100, INF = 0x3f3f3f3f;

ll n;
string s;
ll ans[N];

void solve()
{
    cin >> n >> s;
    s = " " + s;
    for (ll i = 1;i < s.length();i++) {
        ll num = (s[i] - '0') * i;
        ans[1] += num;
        ans[n - i + 2] -= num;
    }
    for (ll i = 0;i <= n;i++) ans[i] += ans[i - 1];

    ll t = 0;
    for (ll i = 1;i <= n;i++) {
        ans[i] += t;
        t = ans[i] / 10;
        ans[i] = ans[i] % 10;
    }
    while (t) ans[++n] = t % 10, t /= 10;
    for (ll i = n;i >= 1;i--) cout << ans[i];
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    //cin>>T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}